#ifndef SCRIPTMODEL_H
#define SCRIPTMODEL_H

#include <QAbstractTableModel>
#include <QList>
#include <QDomDocument>
#include "aed_script.h"

class ScriptModel : public QAbstractTableModel
{
    Q_OBJECT
    QList<AED_Script*> m_scripts;
public:
    explicit ScriptModel(QObject *parent = 0);
    int rowCount(const QModelIndex & parent = QModelIndex()) const;
    int columnCount(const QModelIndex & parent = QModelIndex()) const;
    QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
    QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
    //bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
    Qt::ItemFlags flags(const QModelIndex &index) const;
signals:
    void modified();
public slots:
    void LoadScript(const QString &path);
    void LoadScript(const QString &idpath, const QString &realpath);
    void EraseScript(int index);
    AED_Script* GetScript(int index);
    AED_Script* GetScript(const QString &path);
    void Save(QTextStream &file);
    void Save(QDomDocument &doc, QDomElement &header);
    bool Load(QDomElement &header, QString &scene_path);
    void UpdatePaths(const QString &path);
    void Clean();

};

#endif // SCRIPTMODEL_H
